package masml2jade;

import jade.core.behaviours.SequentialBehaviour;
import java.util.Hashtable;

import masml2jade.agents.MAS_Agent;

public abstract class Plan extends SequentialBehaviour{
	private static final long serialVersionUID = 1L;
	
	private Hashtable<String, Action> actions = new Hashtable<String, Action>();
	// TODO: Pq precisa ter goal, ja que goal tem plan
	private Goal goal;
	
	// Actions
	public Action getAction(String key) {
		return actions.get(key);
	}
	public void addAction(String key, Action action) {
		actions.put(key, action);
	}
	public Action removeAction(String key) {
		return actions.remove(key);
	}
	public void removeAllActions() {
		actions.clear();
	}
	public Hashtable<String, Action> getAllActions() {
		return actions;
	}
	
	public Goal getGoal() {
		return goal;
	}
	public void setGoal(Goal goal) {
		this.goal = goal;
	}
	
	public abstract void execute() ; 
	
	public Plan(Goal goal) {
		super();
		this.goal = goal;
	}
	
	public Plan(Goal goal, MAS_Agent agent) {
		super(agent);
		this.goal = goal;
	}
	
	@Override
	public void onStart() {
		super.onStart();
		execute();
	}
	
}
